From c331a144c096479bc2d55973523f37f572b7f396 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 15 Sep 2009 09:06:46 +0100 Subject: [PATCH] passthrough: remove pointless error checks map_domain_page() cannot return NULL. And if it could, both instances changed here would leak memory in such a case. Signed-off-by: Jan Beulich --- xen/drivers/passthrough/vtd/iommu.c | 2 -- xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index c628d15ef8..2b905ed3ba 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -156,8 +156,6 @@ u64 alloc_pgtable_maddr(struct acpi_drhd_unit *drhd, unsigned long npages) if ( !pg ) return 0; vaddr = map_domain_page(page_to_mfn(pg)); - if ( !vaddr ) - return 0; memset(vaddr, 0, PAGE_SIZE * npages); iommu_flush_cache_page(vaddr, npages); diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h index fa10c3a894..e6b8c8da2c 100644 --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h @@ -131,8 +131,6 @@ static inline struct page_info* alloc_amd_iommu_pgtable(void) if ( pg == NULL ) return 0; vaddr = map_domain_page(page_to_mfn(pg)); - if ( vaddr == NULL ) - return 0; memset(vaddr, 0, PAGE_SIZE); unmap_domain_page(vaddr); return pg; -- 2.30.2